home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.c
- Subject: Re: Settle a bet please
- Date: 5 Apr 1996 18:18:06 -0600
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4k4d7u$rhk@solutions.solon.com>
- References: <4jfopb$o9n@news1.sympatico.ca> <Dp11Bx.2o7@watserv3.uwaterloo.ca> <4k41v6$60v@niamh.indigo.ie>
- Reply-To: seebs@solon.com
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4k41v6$60v@niamh.indigo.ie>, Niall Smart <nsmart@indigo.ie> wrote:
- >> int i; char Name[7] = "My Name";
- >> char More[] = "AAAAAAA";
-
- >char* More[] points to read-only memory containing "AAAAAAA", if you
- >try to change what More is pointing to then the behaviour is
- >undefined. The compiler is probably putting the "AAAAAAA" in a
- >different data space because it is ROM.
-
- There is no "char *More[]" here, and the contents of both Name and More are
- writable, because they are arrays of non-const. What is most likely
- causing them not to be adjacent on some machines is a spare byte of
- padding to keep everything word-aligned. This is not a language feature,
- just a likely explanation.
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- FUCK the communications decency act. Goddamned government. [literally.]
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-